package net.biancheng.service.impl;

import java.util.List;
import net.biancheng.common.utils.DateUtils;
import net.biancheng.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import net.biancheng.mapper.SysDictDataMapper;
import net.biancheng.bean.SysDictData;
import net.biancheng.service.ISysDictDataService;

/**
 * 字典数据Service业务层处理
 * 
 * @author lb
 * @date 2023-11-13
 */
@Service
public class SysDictDataServiceImpl implements ISysDictDataService 
{
    @Autowired
    private SysDictDataMapper sysDictDataMapper;

    /**
     * 查询字典数据
     * 
     * @param id 字典数据主键
     * @return 字典数据
     */
    @Override
    public SysDictData selectSysDictDataById(Long id)
    {
        return sysDictDataMapper.selectSysDictDataById(id);
    }

    /**
     * 查询字典数据列表
     * 
     * @param sysDictData 字典数据
     * @return 字典数据
     */
    @Override
    public List<SysDictData> selectSysDictDataList(SysDictData sysDictData)
    {
        return sysDictDataMapper.selectSysDictDataList(sysDictData);
    }

    /**
     * 根据字典类型查询字典数据列表
     * @param dictType
     * @return
     */
    @Override
    public List<SysDictData> selectSysDictDataListByDictType(String dictType) {
        return sysDictDataMapper.selectSysDictDataListByDictType(dictType);
    }

    /**
     * 新增字典数据
     * 
     * @param sysDictData 字典数据
     * @return 结果
     */
    @Override
    public int insertSysDictData(SysDictData sysDictData)
    {
        sysDictData.setCreateTime(DateUtils.getNowDate());
        sysDictData.setCreateBy(SecurityUtils.getUsername());
        return sysDictDataMapper.insertSysDictData(sysDictData);
    }

    /**
     * 修改字典数据
     * 
     * @param sysDictData 字典数据
     * @return 结果
     */
    @Override
    public int updateSysDictData(SysDictData sysDictData)
    {
        sysDictData.setUpdateTime(DateUtils.getNowDate());
        sysDictData.setUpdateBy(SecurityUtils.getUsername());
        return sysDictDataMapper.updateSysDictData(sysDictData);
    }

    /**
     * 批量删除字典数据
     * 
     * @param ids 需要删除的字典数据主键
     * @return 结果
     */
    @Override
    public int deleteSysDictDataByIds(Long[] ids)
    {
        return sysDictDataMapper.deleteSysDictDataByIds(ids);
    }

    /**
     * 删除字典数据信息
     * 
     * @param id 字典数据主键
     * @return 结果
     */
    @Override
    public int deleteSysDictDataById(Long id)
    {
        return sysDictDataMapper.deleteSysDictDataById(id);
    }
}
